Skip to content

Conversation

@tisonkun
Copy link
Contributor

This follows #2352 (comment).

I push several changes in separate commits. If you'd like to handle them in multiple PRs, please let me know.

Copy link
Member

@Byron Byron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot, that's much appreciated!

All looks good, but it looks like deref is required for convenient access to the error, but I am open to alternative solutions that don't add bloat/inconvenience to the site of creation.

Edit: I set it back into draft so I get a signal when it's deemed ready for review/merge.

@Byron Byron marked this pull request as draft January 18, 2026 15:18
@tisonkun
Copy link
Contributor Author

it looks like deref is required for convenient access to the error

This is correct. I revert the change to keep the current solution. I'll consider whether to add this impl Deref to the exn crate.


/// Use the current exception the head of a chain, adding `errors` to its children.
#[track_caller]
pub fn chain_iter<T, I>(mut self, errors: I) -> Exn<E>
Copy link
Contributor Author

@tisonkun tisonkun Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps change this to chain_all as well.

P.S. I'll start a PR on exn to add these two chain methods. In the initial use case of exn in ScopeDB, we can always know all the children when constructing the chain/tree, so we doubt whether to make children mutable after the chain has been established. But reading gix's use cases, it seems chains that adding children afterwards can be helpful.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps change this to chain_all as well.

That sounds great, please feel free to do this here, otherwise I will do it in a follow-up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I know gix-error has to wrap once more the inner error into Untyped because downcast must have the type param matched. In this case, it seems to be inevitable.

Copy link
Member

@Byron Byron Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory, the into_inner() and into_box() can be removed as there is always gix_error::Error to hold these types.

Let's leave it as is for now, and I will consider removing them to avoid that double-box.

@tisonkun tisonkun marked this pull request as ready for review January 18, 2026 16:06
@tisonkun
Copy link
Contributor Author

All tests passed. Welcome to drop another review.

Copy link
Member

@Byron Byron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thanks so much! It's my pleasure to have you as contributor!

Also, extra-thanks for the cleanup :).

@Byron
Copy link
Member

Byron commented Jan 18, 2026

Oh, may I ask to squash this PR into one commit?
That commit would have to be prefixed with refactor!: as it breaks the API. That doesn't matter yet as the crate isn't released, but we may as well try to stay consistent.

@tisonkun
Copy link
Contributor Author

Oh, may I ask to squash this PR into one commit?

Sure. This is what I typically expected - Since we rely on GitHub, we use PR to track the dev history and squash commits for an easy-reading main linear commit history.

commit would have to be prefixed with refactor!:

Agree. I'd change the PR title now.

@tisonkun tisonkun changed the title refactor: catch up Exn designs with the upstream refactor!: catch up Exn designs with the upstream Jan 18, 2026
@Byron
Copy link
Member

Byron commented Jan 18, 2026

Sorry, I meant the commits. I can always squash via GH or rewrite history, but I'd put words into your mouth and destroy your signatures.

If you don't mind, I can do that of course.

@tisonkun
Copy link
Contributor Author

Sorry, I meant the commits. I can always squash via GH or rewrite history, but I'd put words into your mouth and destroy your signatures.

If you don't mind, I can do that of course.

Never mind. Please do that.

@Byron Byron merged commit f8517be into GitoxideLabs:main Jan 18, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants